package com.wlz.learnjuc.sync;

/**
 *  syncronized 可重入锁
 * @author wlz
 * @date 2022-04-16  7:46 下午
 */
public class SynchronizedReentrantLock {

    private final static Object object = new Object();

    public static void main(String[] args)
    {
        SynchronizedReentrantLock.reentrantlock();
    }

    public static void reentrantlock() {
        String tname = Thread.currentThread().getName();
        synchronized (object) {
            System.out.println(String.format("{}:) hold {}->monitor lock",tname,object));
            synchronized (object) {
                System.out.println(String.format("{}:) re-hold {}->monitor lock",tname,object));
            }
        }
    }


}
